<?php $this->load->view('include/header'); ?>

<?php 
	foreach ($rows as $r){
		echo "<table border='1'>
		<tr>
		<th>Topic ID</th>
		<th>Name</th>
		<th>Supervisior</th>
		<th>Quantity</th>
		<th>Available</th>
		<th>Status</th>
		<th> </th>
		</tr>";
		//if there are many topics
		if ($r){
			echo "<tr>";
			echo '<td align="center">'.$r->thesis_id.'</td>';
			echo '<td align="center">'.$r->name.'</td>';
			$this->session->set_userdata('topicId',$r->thesis_id);
			echo '<td align="center">'.$r->firstname.' '.$r->lastname.'</td>';
			echo '<td align="center">'.$r->quantity_students.'</td>';
			echo '<td align="center">'.($r->quantity_students - $r->accepted).'</td>';
			if ($r->status == 1)
				echo '<td align="center">'."Waiting".'</td>';
			else if ($r->status == 2)
				echo '<td align="center">'."Accepted".'</td>';
			else 	
				echo '<td align="center">'."Rejected".'</td>';
			echo '<td align="center">'. anchor('teacher/viewlist','List').'</td>';
		}
		//no topic avaiable
		else 
			echo '<p>'."You haven't enrolled any topic".'</p>';	
		echo "</table>";
	}
?>

<?php $this->load->view('include/footer'); ?>
